package com.wenyu.wenyuyuedu.activity.homepage;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;

import com.wenyu.wenyuyuedu.R;
import com.wenyu.wenyuyuedu.adapter.homepagefragment.GrideViewViewpageAdapter;
import com.wenyu.wenyuyuedu.utils.AbSharedUtil;
import com.wenyu.wenyuyuedu.utils.SharedConstants;
import com.wenyu.wenyuyuedu.utils.StatusBarUtil;

import java.util.ArrayList;

/*帖子详情的头布局中gridview的点击事件的activ*/
public class InvitationDeatil_HeadViewGridView_Viewpager_Activity extends AppCompatActivity {

    private ViewPager vp;
    private ArrayList<String> imagesViewpager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gridview_viewpager);
        StatusBarUtil.setStatusBar(InvitationDeatil_HeadViewGridView_Viewpager_Activity.this, R.color.photoview_activity);
        initView();
    }

    /*初始化控件*/
    private void initView() {
        Intent intent = getIntent();
        imagesViewpager = intent.getStringArrayListExtra("imagesViewpager");
        int anInt = AbSharedUtil.getInt(InvitationDeatil_HeadViewGridView_Viewpager_Activity.this, SharedConstants.IMAGE_INDEX);
        anInt = intent.getIntExtra("image_index",-1) == -1 ? anInt :intent.getIntExtra("image_index",-1) ;
        vp = (ViewPager) findViewById(R.id.vp_viewpager);
        GrideViewViewpageAdapter grideViewViewpageAdapter = new GrideViewViewpageAdapter(InvitationDeatil_HeadViewGridView_Viewpager_Activity.this, imagesViewpager);
        vp.setAdapter(grideViewViewpageAdapter);
        vp.setCurrentItem(anInt);
    }

    @Override
    protected void onStop() {
        super.onStop();
        finish();
    }
    @Override
    public void finish() {
        super.finish();
    }
    @Override
    protected void onPause() {
        super.onPause();
    }
}
